﻿using System.Linq;
using System.Text;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace TheGame
{
    //Questa classe serve per caricare solo una volta le risorse (sprites, audio)
    //I riferiemnti alle risorse vengono acceduti da ogni istanza delle classi Mudokon/MudokonAI e Abe/AbeControl
    public class MudokonFactory
    {
        #region VARS
        public Texture2D BombDeactivate_R;
        public Texture2D BombDeactivate_L;
        public Texture2D BombDeactivateFail_R;
        public Texture2D BombDeactivateFail_L;

        public Texture2D BombExplode_C;

        public Texture2D Walk_1PASS_R;
        public Texture2D Walk_1PASS_L;
        public Texture2D Walk_2PASS_R;
        public Texture2D Walk_2PASS_L;
        public Texture2D Walk_3PASS_R;
        public Texture2D Walk_3PASS_L;

        public Texture2D Crouch_R;
        public Texture2D Crouch_L;

        public Texture2D StandUp_R;
        public Texture2D StandUp_L;

        public Texture2D Stop_R;
        public Texture2D Stop_L;

        public Texture2D Turn_R;
        public Texture2D Turn_L;

        public Texture2D Roll1_R;
        public Texture2D Roll1_L;
        public Texture2D Roll2_R;
        public Texture2D Roll2_L;
        public Texture2D Roll3_R;
        public Texture2D Roll3_L;

        public Texture2D TurnDown_R;
        public Texture2D TurnDown_L;

        public Texture2D Wait_R;
        public Texture2D Wait_L;

        public Texture2D WaitCrouch_R;
        public Texture2D WaitCrouch_L;

        public Texture2D JumpUp_R;
        public Texture2D JumpUp_L;

        public Texture2D JumpDown_R;
        public Texture2D JumpDown_L;

        public Texture2D Hung_R;
        public Texture2D Hung_L;
        public Texture2D HungLong_R;
        public Texture2D HungLong_L;

        public Texture2D Block_R;
        public Texture2D Block_L;

        public Texture2D Block1_R;
        public Texture2D Block2_R;
        public Texture2D Block1_L;
        public Texture2D Block2_L;

        public Texture2D HoistUp_R;
        public Texture2D HoistUp_L;
        public Texture2D HoistDown_R;
        public Texture2D HoistDown_L;

        public Texture2D HoistUp1_R;
        public Texture2D HoistUp2_R;
        public Texture2D HoistUp1_L;
        public Texture2D HoistUp2_L;

        public Texture2D HoistDown1_R;
        public Texture2D HoistDown2_R;
        public Texture2D HoistDown1_L;
        public Texture2D HoistDown2_L;

        public Texture2D GoDown_L;
        public Texture2D GoDown_R;
        public Texture2D Plane_R;
        public Texture2D Plane_L;

        public Texture2D Jump1_R;
        public Texture2D Jump2_R;
        public Texture2D Jump3_R;
        public Texture2D Jump4_R;
        public Texture2D Jump1_L;
        public Texture2D Jump2_L;
        public Texture2D Jump3_L;
        public Texture2D Jump4_L;

        public Texture2D Ko_R;
        public Texture2D Ko_L;
        public Texture2D GetUp_R;
        public Texture2D GetUp_L;

        public Texture2D PulLever_R;
        public Texture2D PulLever_L;

        public Texture2D Run1_R;
        public Texture2D Run1_L;
        public Texture2D Run2_R;
        public Texture2D Run2_L;
        public Texture2D Run3_R;
        public Texture2D Run3_L;
        public Texture2D Run4_R;
        public Texture2D Run4_L;
        public Texture2D Run5_R;
        public Texture2D Run5_L;
        public Texture2D RunStop1_R;
        public Texture2D RunStop1_L;
        public Texture2D RunStop2_R;
        public Texture2D RunStop2_L;
        public Texture2D RunJump1_R;
        public Texture2D RunJump1_L;
        public Texture2D RunJump2_R;
        public Texture2D RunJump2_L;
        public Texture2D RunJump3_R;
        public Texture2D RunJump3_L;
        public Texture2D RunJump4_R;
        public Texture2D RunJump4_L;

        public Texture2D Sneak1_R;
        public Texture2D Sneak2_R;
        public Texture2D Sneak3_R;
        public Texture2D Sneak1_L;
        public Texture2D Sneak2_L;
        public Texture2D Sneak3_L;
        public Texture2D SneakStop_R;
        public Texture2D SneakStop_L;

        public Texture2D Die_R;
        public Texture2D Die_L;

        public Texture2D Omm_R;
        public Texture2D Omm_L;

        public Texture2D EnterDoor_R;
        public Texture2D EnterDoor_L;
        public Texture2D ExitDoor_R;
        public Texture2D ExitDoor_L;

        public Texture2D CleanUp;
        public Texture2D RestUp;
        public Texture2D CleanUpStop_R;
        public Texture2D CleanUpStop_L;
        public Texture2D CleanDown_R;
        public Texture2D CleanDown_L;


        public SoundEffect Sound_PASS;
        public SoundEffect Sound_TURN;
        public SoundEffect Sound_JUMP;
        public SoundEffect Sound_RUNSTOP;
        public SoundEffect Sound_SNEAK;
        public SoundEffect Sound_IMPACT;
        public SoundEffect Sound_HELLO;
        public SoundEffect Sound_FOLLOW;
        public SoundEffect Sound_WAIT;
        public SoundEffect Sound_ROLL;
        public SoundEffect Sound_OK;
        public SoundEffect Sound_OMM;
        public SoundEffect Sound_ENTERPORTAL;
        public SoundEffect Sound_COMMANDJUMP;
        public SoundEffect Sound_COMMANDRUNJUMP; 


        public Game1 game;
        #endregion

        public MudokonFactory(Game1 game)
        {
            this.game = game;

            BombDeactivate_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BOMBINNESCODEACTIVATE_R_120");
            BombDeactivate_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BOMBINNESCODEACTIVATE_L_120");

            BombDeactivateFail_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BOMBINNESCOEXPLODE1_R_120");
            BombDeactivateFail_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BOMBINNESCOEXPLODE1_L_120");

            BombExplode_C = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BOMBINNESCOEXPLODE2_C_120");

            Walk_1PASS_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PASS1_R_180");
            Walk_2PASS_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PASS2_R_180");
            Walk_3PASS_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PASS3_R_180");

            Walk_1PASS_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PASS1_L_180");
            Walk_2PASS_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PASS2_L_180");
            Walk_3PASS_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PASS3_L_180");

            Stop_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\STOP_R_180");
            Stop_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\STOP_L_180");

            Wait_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\WAIT_R_70");
            Wait_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\WAIT_L_70");

            WaitCrouch_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\WAITcROUCH_R_70");
            WaitCrouch_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\WAITcROUCH_L_70");

            Turn_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\TURN_R_70");
            Turn_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\TURN_L_70");

            TurnDown_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\TURNdOWN_R_70");
            TurnDown_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\TURNdOWN_L_70");

            Roll1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ROLL1_R_180");
            Roll1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ROLL1_L_180");
            Roll2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ROLL2_R_180");
            Roll2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ROLL2_L_180");
            Roll3_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ROLL3_R_180");
            Roll3_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ROLL3_L_180");

            Jump1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP1_R_200");
            Jump2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP2_R_200");
            Jump3_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP3_R_200");
            Jump4_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP4_R_200");
            Jump1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP1_L_200");
            Jump2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP2_L_200");
            Jump3_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP3_L_200");
            Jump4_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMP4_L_200");

            JumpUp_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMPUP_R_80");
            JumpUp_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMPUP_L_80");

            JumpDown_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMPDOWN_R_80");
            JumpDown_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\JUMPDOWN_L_80");

            Hung_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HUNG_R_70");
            Hung_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HUNG_L_70");
            HungLong_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HUNGLONG_R_120");
            HungLong_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HUNGLONG_L_120");

            Crouch_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\CROUCH_R_180");
            Crouch_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\CROUCH_L_180");
            StandUp_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\STANDUP_R_180");
            StandUp_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\STANDUP_L_180");

            Block_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BLOCK_R_80");
            Block_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\BLOCK_L_80");

            HoistUp_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HOISTUP_R_80");
            HoistUp_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HOISTUP_L_80");
            HoistDown_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HOISTDOWN_R_80");
            HoistDown_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\HOISTDOWN_L_80");

            Block1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\BLOCK1_R_200");
            Block2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\BLOCK2_R_200");
            Block1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\BLOCK1_L_200");
            Block2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\BLOCK2_L_200");

            HoistUp1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTuP1_R_210");
            HoistUp2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTuP2_R_210");
            HoistUp1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTuP1_L_210");
            HoistUp2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTuP2_L_210");

            HoistDown1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTdOWN1_R_210");
            HoistDown2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTdOWN2_R_210");
            HoistDown1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTdOWN1_L_210");
            HoistDown2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Abe\\HOISTdOWN2_L_210");

            GoDown_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\GODOWN_L_160");
            GoDown_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\GODOWN_R_160");
            Plane_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PLANE_L_160");
            Plane_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PLANE_R_160");

            Ko_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\KO_R_130");
            Ko_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\KO_L_130");
            GetUp_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\GETUP_R_130");
            GetUp_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\GETUP_L_130");

            Run1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN1_R_300");
            Run1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN1_L_300");
            Run2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN2_R_300");
            Run2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN2_L_300");
            Run3_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN3_R_300");
            Run3_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN3_L_300");
            Run4_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN4_R_300");
            Run4_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN4_L_300");
            Run5_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN5_R_300");
            Run5_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUN5_L_300");
            RunStop1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNSTOP1_R_300");
            RunStop2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNSTOP2_R_300");
            RunStop1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNSTOP1_L_300");
            RunStop2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNSTOP2_L_300");
            RunJump1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP1_R_260");
            RunJump1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP1_L_260");
            RunJump2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP2_R_260");
            RunJump2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP2_L_260");
            RunJump3_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP3_R_260");
            RunJump3_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP3_L_260");
            RunJump4_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP4_R_260");
            RunJump4_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RUNJUMP4_L_260");

            Sneak1_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAK1_R_200");
            Sneak2_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAK2_R_200");
            Sneak3_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAK3_R_200");
            Sneak1_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAK1_L_200");
            Sneak2_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAK2_L_200");
            Sneak3_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAK3_L_200");
            SneakStop_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAKsTOP_R_200");
            SneakStop_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SNEAKsTOP_L_200");

            Die_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SHOOTSPLAT_R_130");
            Die_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\SHOOTSPLAT_L_130");

            PulLever_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PULLEVER_R_110");
            PulLever_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\PULLEVER_L_110");

            Omm_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\OMM_R_80");
            Omm_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\OMM_L_80");

            EnterDoor_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ENTERDOOR_R_80");
            EnterDoor_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\ENTERDOOR_L_80");
            ExitDoor_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\EXITDOOR_R_80");
            ExitDoor_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\EXITDOOR_L_80");

            CleanUp = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\CLEANUP_C_80");
            RestUp = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\RESTUP_C_80");
            CleanUpStop_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\STOPCLEANUP_R_90");
            CleanUpStop_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\STOPCLEANUP_L_90");
            CleanDown_R = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\CLEANDOWN_R_80");
            CleanDown_L = game.Content.Load<Texture2D>("Sprite_Sheet\\Mudokon\\CLEANDOWN_L_80");

            ///////////////////////////////////////////////////////////

            Sound_PASS = game.Content.Load<SoundEffect>("Sound\\PASS");
            Sound_TURN = game.Content.Load<SoundEffect>("Sound\\TURN");
            Sound_JUMP = game.Content.Load<SoundEffect>("Sound\\JUMP");
            Sound_RUNSTOP = game.Content.Load<SoundEffect>("Sound\\RUNSTOP");
            Sound_SNEAK = game.Content.Load<SoundEffect>("Sound\\SNEAK");
            Sound_IMPACT = game.Content.Load<SoundEffect>("Sound\\IMPACT");
            Sound_HELLO = game.Content.Load<SoundEffect>("Sound\\HELLO");
            Sound_FOLLOW = game.Content.Load<SoundEffect>("Sound\\FOLLOW");
            Sound_WAIT = game.Content.Load<SoundEffect>("Sound\\WAIT");
            Sound_ROLL = game.Content.Load<SoundEffect>("Sound\\ROLL");
            Sound_OK = game.Content.Load<SoundEffect>("Sound\\OK");
            Sound_OMM = game.Content.Load<SoundEffect>("Sound\\OMM");
            Sound_ENTERPORTAL = game.Content.Load<SoundEffect>("Sound\\PORTALOPENING");
            Sound_COMMANDJUMP = game.Content.Load<SoundEffect>("Sound\\COMMANDJUMP");
            Sound_COMMANDRUNJUMP = game.Content.Load<SoundEffect>("Sound\\COMMANDRUNJUMP");
        }
    }
}
